package Builder;

public class Actor {
    private String type;
    private String sex;
    private String face;
    private String costume;
    private String hairstyle;

    public void setType(String type) {
        this.type = type;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public void setFace(String face) {
        this.face = face;
    }

    public void setCostume(String costume) {
        this.costume = costume;
    }

    public void setHairstyle(String hairstyle) {
        this.hairstyle = hairstyle;
    }

    public String getType() {
        return type;
    }

    public String getSex() {
        return sex;
    }

    public String getFace() {
        return face;
    }

    public String getCostume() {
        return costume;
    }

    public String getHairstyle() {
        return hairstyle;
    }
}

abstract class ActorBuilder {
    protected Actor actor = new Actor();

    public abstract void buildType();
    public abstract void buildSex();
    public abstract void buildFace();
    public abstract void buildCostume();
    public abstract void buildHairstyle();

    public Actor createActor() {
        return this.actor;
    }
}

class HeroBuilder extends ActorBuilder {
    @Override
    public void buildType() {
        actor.setType("Hero");
    }

    @Override
    public void buildSex() {
        actor.setSex("Male");
    }

    @Override
    public void buildFace() {
        actor.setFace("Handsome");
    }

    @Override
    public void buildCostume() {
        actor.setCostume("Armor");
    }

    @Override
    public void buildHairstyle() {
        actor.setHairstyle("Short");
    }
}

class AngelBuilder extends ActorBuilder {
    @Override
    public void buildType() {
        actor.setType("Angel");
    }

    @Override
    public void buildSex() {
        actor.setSex("Female");
    }

    @Override
    public void buildFace() {
        actor.setFace("Beautiful");
    }

    @Override
    public void buildCostume() {
        actor.setCostume("White Robe");
    }

    @Override
    public void buildHairstyle() {
        actor.setHairstyle("Long");
    }
}

class DevilBuilder extends ActorBuilder {
    @Override
    public void buildType() {
        actor.setType("Devil");
    }

    @Override
    public void buildSex() {
        actor.setSex("Male");
    }

    @Override
    public void buildFace() {
        actor.setFace("Ugly");
    }

    @Override
    public void buildCostume() {
        actor.setCostume("Black Robe");
    }

    @Override
    public void buildHairstyle() {
        actor.setHairstyle("Spiky");
    }
}

class ActorController {
    public Actor construct(ActorBuilder ab) {
        ab.buildType();
        ab.buildSex();
        ab.buildFace();
        ab.buildCostume();
        ab.buildHairstyle();
        return ab.createActor();
    }
}

class TestActorBuilder {
    public static void main(String[] args) {
        // 创建控制器
        ActorController controller = new ActorController();

        // 使用 HeroBuilder 构建 Hero 类型的 Actor
        ActorBuilder heroBuilder = new HeroBuilder();
        Actor hero = controller.construct(heroBuilder);
        System.out.println("Hero Details:");
        printActorDetails(hero);

        // 使用 AngelBuilder 构建 Angel 类型的 Actor
        ActorBuilder angelBuilder = new AngelBuilder();
        Actor angel = controller.construct(angelBuilder);
        System.out.println("\nAngel Details:");
        printActorDetails(angel);

        // 使用 DevilBuilder 构建 Devil 类型的 Actor
        ActorBuilder devilBuilder = new DevilBuilder();
        Actor devil = controller.construct(devilBuilder);
        System.out.println("\nDevil Details:");
        printActorDetails(devil);
    }

    // 打印 Actor 的详细信息
    private static void printActorDetails(Actor actor) {
        System.out.println("Type: " + actor.getType());
        System.out.println("Sex: " + actor.getSex());
        System.out.println("Face: " + actor.getFace());
        System.out.println("Costume: " + actor.getCostume());
        System.out.println("Hairstyle: " + actor.getHairstyle());
    }
}
